package com.quasar.hpatient.presenter;

import com.quasar.hpatient.model.httpmodel.DataHeadResult;
import com.quasar.hpatient.model.httpmodel.DataStateResult;
import com.quasar.hpatient.model.medicalmodel.PatientInfoData;
import com.quasar.hpatient.model.requestmodel.RequestModel;
import com.quasar.hpatient.onInterface.AnotherResultListener;
import com.quasar.hpatient.onInterface.OnEditUserListener;
import com.quasar.hpatient.view.personal.EditUserActivity;

/**
 * author : 许建宏
 * Date: 2017/10/20 0020
 * View:修改用户资料
 */

public class PostEditUserPresenter {

    private RequestModel requestModel;
    private OnEditUserListener onEditUserListener;

    public PostEditUserPresenter(OnEditUserListener onEditUserListener) {
        this.requestModel = new RequestModel();
        this.onEditUserListener = onEditUserListener;
    }

    public void PostEditUserOperation(String cover, String nick,
                                      String realName, String bloodId,
                                      String idCard, String birthday,
                                      String sex, String optime,
                                      String hosId, String sourceId,
                                      String commonId, String address,String supervisorDoctor,String protopathy) {
        requestModel.PostEditUser(cover, nick,
                realName, bloodId,
                idCard, birthday,
                sex, optime,
                hosId, sourceId,
                commonId, address,supervisorDoctor,protopathy, new AnotherResultListener<DataStateResult>() {
                    @Override
                    public void onSuccess(DataStateResult data) {
                        onEditUserListener.onSuccess(data);
                    }

                    @Override
                    public void onError(String msg) {
                        onEditUserListener.onError(msg);
                    }

                    @Override
                    public void onRefreshUI() {
                        onEditUserListener.onRefreshUI();
                    }
                });
    }

    public void SelectTheTotalBodyData(String iphone){

        requestModel.SelectTheTotalBodyData(iphone, new AnotherResultListener<DataStateResult>() {
            @Override
            public void onSuccess(DataStateResult data) {
                onEditUserListener.onWithDonorSuccess(data);
            }

            @Override
            public void onError(String msg) {
                onEditUserListener.onError(msg);
            }

            @Override
            public void onRefreshUI() {
                onEditUserListener.onRefreshUI();
            }
        });
    }

    public void SelectTheTotalBody2Data(){

        requestModel.SelectTheTotalBody2Server(new AnotherResultListener<DataHeadResult<PatientInfoData>>() {
            @Override
            public void onSuccess(DataHeadResult<PatientInfoData> data) {
                onEditUserListener.onWithObtain(data);
            }

            @Override
            public void onError(String msg) {
                onEditUserListener.onError(msg);
            }

            @Override
            public void onRefreshUI() {
                onEditUserListener.onRefreshUI();
            }
        });
    }
}
